package com.fit.services;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.Scope;

import com.fit.beans.BorrowBean;
import com.fit.beans.CarBean;
import com.fit.beans.ServiceBean;
import com.fit.beans.UserBean;
import com.fit.enums.AccountRole;
import com.fit.interfaces.BorrowI;
import com.fit.interfaces.CarI;
import com.fit.interfaces.ServiceI;
import com.fit.interfaces.User;

@Configuration
//@ImportResource("classpath:/*applicationContext.xml")
public class SpringConfig {

	public @Bean @Scope("prototype") User user(){
		User user = new UserBean();
		user.setRole(AccountRole.USER);
		return user;
	}
	
	public @Bean @Scope("prototype") CarI car(){
		return new CarBean();
	}
	
	public @Bean @Scope("prototype") BorrowI borrow(){
		return new BorrowBean();
	}
	public @Bean @Scope("prototype") ServiceI service(){
		return new ServiceBean();
	}
	
	public @Bean @Scope("singleton") User admin(){
		User user = new UserBean();
		user.setId(1);
		user.setFullName("Nikola Jokovic");
		user.setUserName("admin");
		user.setPassword("admin");
		user.setRole(AccountRole.ADMINISTRATOR);
		return user;
	}
	
//	public @Bean @Scope("singleton")User employer(){
//		User user = new UserBean();
//		//user.setUser_id(2);
//		user.setFullName("Pedja Suskacevic");
//		user.setUserName("employer");
//		user.setPassword("employer");
//		user.setAccountRole(AccountRole.EMPlOYER);
//		return user;
//	}
//	public @Bean @Scope("singleton")User userAccount(){
//		User user = new UserBean();
//		user.setFullName("Dragan Stamenkovic");
//		user.setUserName("user");
//		user.setPassword("user");
//		user.setRole(AccountRole.USER);
//		return user;
//	}
}
